Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config: new interpolation function jsonencode #5890

Merged
merged 1 commit into from
Mar 29, 2016

Conversation

glasser
Copy link
Contributor

@glasser glasser commented Mar 29, 2016

We find ourselves wanting to construct JSON config files in (eg) S3 bucket objects based on the values of Terraform variables, so being able to JSON-encode strings safely is helpful.

`${jsonencode(hard)}`,
`" foo \\ \n \t \" bar "`,
false,
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind adding one more test case with an empty string to confirm that an error is returned in such cases?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can add a test case for the empty string, but why should it be an error rather than ""?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a test case for the empty string (no error) and for no argument given (error).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty string should remain empty string, naturally. 👍 I was more looking for any test covering the erroneous state.

@radeksimko
Copy link
Member

Besides the test case w/ failure, this is looking good. It has other good test cases + documentation. 👍

@radeksimko radeksimko added the waiting-response An issue/pull request is waiting for a response from the community label Mar 29, 2016
@radeksimko radeksimko removed the waiting-response An issue/pull request is waiting for a response from the community label Mar 29, 2016
@radeksimko radeksimko merged commit c7a8f05 into hashicorp:master Mar 29, 2016
@glasser
Copy link
Contributor Author

glasser commented Mar 29, 2016

Thanks!

@ghost
Copy link

ghost commented Apr 27, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants